<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});


//登录页面
Route::get('/login', function() {
	echo "这里是登陆页面";
});

//写入cookie
Route::get('/cookie', function() {
	setcookie('username', 'wss', time()+3600, '/');
});

//后台页面
Route::get('/admin',function() {
	echo "这里是后台页面!";
});

//帖子详情
Route::get('/{id}.html',function($id) {
	echo "这里是帖子详情!  第".$id."篇文章!";
}) -> where('id','\d+');

//后台模块修改
Route::get('/Admin/Moban/edit/{id}', [
		'as' => 'b-e',
		'uses' => function() {
			// echo '后台修改界面!!';
			//通过别名创建url
			echo route('b-e',['id' => 10]);
		}
	]);

//后台路由组
Route::group(['middleware' => 'check-login'],function() {
	//后台首页
	Route::get('/admin', function() {
		echo '后台页面!';
		// abort(404);
	});
	//后台用户列表
	Route::get('/Admin/User/list', function() {
		echo "用户列表!!";
	});

	//用户个人中心
	Route::get('/user/center', function() {
		echo "这里是用户个人中心!!!!";
	}) -> middleware('check-login');
});

//api路由组
Route::group([], function() {
	Route::get('/api/userlist', function() {

	});
	Route::get('/api/tiezi', function() {

	});
});
//用户列表显示路由
Route::get('/user','UserController@index');
Route::get('/user/create','UserController@create');
Route::get('/user/delete/{id}','UserController@delete');